package com.example.tests.lesson0;

import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.thoughtworks.selenium.SeleneseTestCase;
import com.thoughtworks.selenium.Selenium;

import java.util.regex.Pattern;

public class WD extends SeleneseTestCase {
	@Before
	public void setUp() throws Exception {
		WebDriver driver = new FirefoxDriver();
		String baseUrl = "http://www.baidu.com/";
		Selenium selcenium = new WebDriverBackedSelenium(driver, baseUrl);
		selenium.start();
	}

	@Test
	public void testWD() throws Exception {
		selenium.open("/");
		selenium.click("kw");
		selenium.type("kw", "test");
		selenium.click("su");
		selenium.waitForPageToLoad("30000");
		selenium.click("container");
		selenium.click("link=Documentation");
		selenium.waitForPageToLoad("30000");
		selenium.click("link=Download");
		selenium.waitForPageToLoad("30000");
	}

	@After
	public void tearDown() throws Exception {
		selenium.stop();
	}
}
